home *** CD-ROM | disk | FTP | other *** search
- #include <string.h>
-
- /*********************************************************/
- short charinstr(char c, char *string)
- /*********************************************************
- Return true if c is in string otherwise return false
- **********************************************************/
- { for(;*string; string++) if(c == *string) return(1);
- return(0); }
-
-
- /*********************************************************/
- char *strupper(char *string)
- /*********************************************************
- Makes string uppercase (return same string)
- **********************************************************/
- { char *savestring = string;
- for(;*string; string++) if((*string>='a') && (*string<='z'))
- *string -= 'a' - 'A';
- return(savestring); }
-
-
- /**********************************************************/
- short CmpString(char *cmd, char *table[], long n, long dist)
- /**********************************************************
- Test a string against a table of string pointers,
- using every 'dist' pointer for a total of 'n' compares
- return -1 on fail
- otherwise the index (ith compare ie 0, 1, 2 ... )
- **********************************************************/
- {
- short i, j;
- for(i = 0, j = 0; i < n; i++)
- if(table[j] && (strncmp(cmd, table[j], strlen(table[j])) == 0)) return(i);
- else j += dist;
- return(-1);
- }
-
-
- /**********************************************************/
- char *FindChar(char *string, char *instring)
- /**********************************************************
- Find first character of 'string' contained in 'instring'
- **********************************************************/
- {
- short i, j;
- if(!(string && instring)) return(0);
- for(i = 0; string[i]; i++)
- for(j = 0; instring[j]; j++)
- if(string[i] == instring[j]) return(&string[i]);
- return(0);
- }
-
-
- /**********************************************************/
- char *SkipChar(char *string, char *instring)
- /**********************************************************
- Find first character of 'string' not contained in 'instring'
- **********************************************************/
- {
- short i, j;
- if(!(string && instring)) return(0);
- for(i = 0; string[i]; i++) {
- for(j = 0; instring[j] && (instring[j] != string[i]); j++);
- if(instring[j] == '\0') return(&string[i]);
- }
- return(0);
- }
-
-
-